package edu.gxnu.cetcdemo.utils;


import com.auth0.jwt.JWT;
import com.auth0.jwt.algorithms.Algorithm;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.util.Date;

@Data
@Component
public class JwtHelper {
    public static String getToken(String userId){
        return JWT.create()
                .withAudience(userId)
                .withSubject("token")
                .withExpiresAt(new Date(System.currentTimeMillis() + 1000 * 60))
                .sign(Algorithm.HMAC256("CetcSever"));
    }
}

